/*
 * Tezad - Classic puzzle game
 * Copyright 2009 Shayne Riley and Paul Maseberg
 *
 * Tezad is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Tezad is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Tezad.  If not, see <http://www.gnu.org/licenses/>
 * or write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * To contact the authors on questions or issues regarding the license,
 * you may send an email to <pezads at gmail dot com>
 */

#ifndef GAMEMINOSTATE_H_
#define GAMEMINOSTATE_H_

/**
 * Describes the state of an active (a.k.a. in-play) Mino. Three basic
 * components of the state are its orientation (rotation), its vertical position
 * (row), and its horizontal position (column).
 */
class GameMinoState
{
public:
    /**
     * Constructor.
     * @param inRow the row of the "origin brick" of the Mino. May be any value
     *  inside a signed 32-bit integer.
     * @param inCol the column of the "origin brick.". May be any value
     *  inside a signed 32-bit integer.
     * @param inOrientation The rotation that the Mino is in. Should be between
     *  0 and 3 inclusive, but any value is fine (it will be modulo divided.)
     */
    GameMinoState(int inRow = 0, int inCol = 0, int inOrientation = 0);
    virtual ~GameMinoState();

    /// Return the row of the "origin brick" of the Mino. May be any value.
    int row() const;

    /// Return the column of the "origin brick" of the Mino. May be any value.
    int col() const;

    /**
     * Return the orientation (a.k.a. rotation) of an active Mino. Only four
     * values are possible:
     * * 0 - Original orientation
     * * 1 - 90 degree rotation Counter-Clockwise (CCW)
     * * 2 - 180 degree rotation
     * * 3 - 270 degree rotation CCW
     */
    int orientation() const;

    /// Returns a counter-clockwise rotated Mino in a new GameMinoState.
    GameMinoState rotateCCW() const;

    /// Returns a clockwise rotated Mino in a new GameMinoState.
    GameMinoState rotateCW() const;

    /// Returns a Mino shifted to the left in a new GameMinoState.
    GameMinoState shiftLeft() const;

    /// Returns a Mino shifted to the right in a new GameMinoState.
    GameMinoState shiftRight() const;

    /// Returns a Mino shifted up in a new GameMinoState.
    GameMinoState shiftUp() const;

    /// Returns a Mino shifted down in a new GameMinoState.
    GameMinoState shiftDown() const;

private:
    int mRow;
    int mCol;
    int mOrientation;
};

#endif /* GAMEMINOSTATE_H_ */
